
# ExternalProject 引入外部项目
include(ExternalProject)

set(libqnotify          "qt-notify_git")
set(libqnotify_git      https://gitee.com/zinface/qt-notify)

set(libqnotify_prefix   ${CMAKE_CURRENT_BINARY_DIR}/${libqnotify}-prefix)
set(libqnotify_src      ${libqnotify_prefix})
set(libqnotify_build    ${libqnotify_prefix}/build)
set(libqnotify_install  ${libqnotify_prefix}/install)


ExternalProject_Add(qt-notify_git
    GIT_REPOSITORY ${libqnotify_git}
    GIT_TAG "qnotify-cmake-find-package"

    EXCLUDE_FROM_ALL TRUE

    INSTALL_COMMAND ${CMAKE_COMMAND} --install . --prefix ${libqnotify_install}
)

# 第一种：使用 find_package 查找 QNotify
find_package(QNotify PATHS ${libqnotify_install})


# 第二种： 对 qnotify 的定义(手动)
# add_library(qnotify STATIC IMPORTED)
# set_target_properties(qnotify 
#     PROPERTIES
#         IMPORTED_LOCATION  ${libqnotify_install}/lib/libqnotify.a
#         INTERFACE_LINK_DIRECTORIES ${libqnotify_install}/lib
# )
# target_include_directories(${PROJECT_NAME}
#     PUBLIC    
#         ${libqnotify_install}/include
#         ${libqnotify_install}/include/qnotify
# )
# add_dependencies(qnotify qt-notify_git)


